<template>
  <view class="page-content">
    {{ titleText }}
    <task-item
      v-for="el in taskList"
      :info="el"
      :projectInfo="objData"
    ></task-item>
  </view>
</template>
<script lang="ts" setup>
import taskItem from '@/pageProject/project/work/components/taskItem.vue';
import { getPhaseList } from '@/api/modules/project';
import { onShow } from '@dcloudio/uni-app';

const taskList = ref<any[]>();
const queryPhaseList = () => {
  const params = {
    projectId: projectId.value,
    phaseId: phaseId.value,
    sortType: 1,
    selfTask: false,
  };
  getPhaseList(params).then((res: any) => {
    console.log(res);
    taskList.value = res[0].taskList;
  });
};

const phaseId = ref<string>('');
const projectId = ref<string>('');
const objData = ref<any>({});
const titleText = ref<string>('');
onShow(() => {
  const {
    phaseId: phid,
    projectId: prId,
    projectInfo,
    title,
  } = (uni as any).$Router.getQuery();
  phaseId.value = phid;
  projectId.value = prId;
  objData.value = projectInfo;
  titleText.value = title;
  queryPhaseList();
});
</script>
<style lang="scss">
.page-content {
  padding: 20rpx;
}
</style>
